package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDTO;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/sensitive")
@Api(value = "敏感词管理",tags = "敏感词管理")
public class AdSensitiveController {
    @Autowired
    private AdSensitiveService adSensitiveService;

    @ApiOperation(value = "查询敏感词")
    @PostMapping("/list")
    public PageResponseResult findSensitive(@RequestBody SensitiveDTO dto){
        return adSensitiveService.findSensitive(dto);
    }

    @ApiOperation(value = "新增敏感词")
    @PostMapping("/save")
    public ResponseResult insertSensitive(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.insertSensitive(adSensitive);
    }

    @ApiOperation(value = "修改敏感词")
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.updateSensitive(adSensitive);
    }

    @ApiOperation(value = "删除敏感词")
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitive(@PathVariable("id") Integer id){
        return adSensitiveService.deleteSensitive(id);
    }
}
